﻿using System;
using Com.Ctrip.Framework.Apollo;
using Com.Ctrip.Framework.Apollo.Internals;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;

namespace rabbitmqdemo.Controllers
{
    [Route("api/config")]
    public class ConfigController : Controller
    {
        private ConfigurationDemo demo;

        public ConfigController(ConfigurationDemo demo)
        {
            this.demo = demo;
        }

        [HttpGet]
        [Route("get")]
        public Object GetConfig()
        {
            return new
            {
                esurl = demo.GetConfig("EsUrl"),
                rpdatabase = demo.GetConfig("RpDatabase"),
                retailking = demo.GetConfig("RetailKing"),
                erpcost = demo.GetConfig("ErpCost"),
            };
        }
    }
}